package com.neuedu.nevserver.controller;


import com.neuedu.nevserver.pojo.ProductType;
import com.neuedu.nevserver.service.ProductTypeService;
import com.neuedu.nevserver.vo.ResultVO;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;

import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author sjy
 * @since 2025-03-18
 */
@RestController
@RequestMapping("/product-type")
@Api(tags="产品类型管理",description = "提供产品类型API接口")
public class ProductTypeController {

    @Autowired
    private ProductTypeService productTypeService;

    @GetMapping("/listProductByParent")
    @ApiOperation("查询产品类型列表")
    public ResultVO<List<ProductType>> listProductByParent(Integer parentId) throws Exception{
        return productTypeService.listProductByParent(parentId);
    }

    @GetMapping("/listProductByNode")
    @ApiOperation("根据流通节点查询产品类型列表")
    public ResultVO<List<ProductType>> listProductByNode(Integer nodeId) throws Exception{
        return productTypeService.listProductByNode(nodeId);
    }
}
